Hệ thống quản lý bệnh viện bằng C# với mã nguồn
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
10 using System.Data.SqlClient;
11
12 namespace HospitalManagementSystemCSharp
13 {
14 public partial class ViewwPatientCheckOut : Form
15 {
16 public ViewwPatientCheckOut()
17 {
18 InitializeComponent();
19 }
20
21 private void ViewwPatientCheckOut_Load(object sender, EventArgs e)
22 {
23 // TODO: This line of code loads data into the 'hospitalDataSet3.checkout' table. You can move, or remove it, as needed.
24 this.checkoutTableAdapter.Fill(this.hospitalDataSet3.checkout);
25 using (SqlConnection con1 = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\Sem.4\C# Projects\Trials\HospitalManagementSystemCSharp\HospitalManagementSystemCSharp\hospital.mdf;Integrated Security=True"))
26 {
27
28 string str2 = "SELECT * FROM checkout";
29 SqlCommand cmd2 = new SqlCommand(str2, con1);
30 SqlDataAdapter da = new SqlDataAdapter(cmd2);
31 DataTable dt = new DataTable();
32 da.Fill(dt);
33 dataGridView1.DataSource = new BindingSource(dt, null);
34 }
35 }
36
37 private void button1_Click(object sender, EventArgs e)
38 {
39 using (SqlConnection con1 = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\Sem.4\C# Projects\Trials\HospitalManagementSystemCSharp\HospitalManagementSystemCSharp\hospital.mdf;Integrated Security=True"))
40 {
41
42 string str2 = "SELECT * FROM checkout where id='"+textBox1.Text +"'";
43 SqlCommand cmd2 = new SqlCommand(str2, con1);
44 SqlDataAdapter da = new SqlDataAdapter(cmd2);
45 DataTable dt = new DataTable();
46 da.Fill(dt);
47 dataGridView1.DataSource = new BindingSource(dt, null);
48 }
49 }
50 }
51 }
TODO: This line of code loads data into the 'hospitalDataSet3.checkout' table. You can move, or remove it, as needed.